/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.alcj.model;

import com.alcj.common.utils.IdGen;
import com.alcj.common.utils.StringUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 车辆资料Entity
 * @author wdl
 * @version 2017-10-19
 */
public class CarData {
	private String id;
	private static final long serialVersionUID = 1L;
	private User user;		// 用户
	private String recognitionCode;		// 车辆识别代码
	private String plateNumber;		// 车牌号码
	private String plateType;		// 车牌类型
	private String holder;		// 所有人
	private Date registerDate;		// 注册日期
	private String brandModel;		// 品牌型号
	private String address;		// 住址
	private String fuelType;		// 燃油种类
	private String createUser;		// 创建人
	private String updateUser;		// 修改者
	private Date createDate;	// 创建日期
	private Date updateDate;	// 更新日期
	private String imgUrl; 	// 行驶证路径
	private String isOwner; 	// 认证车主标志位 0 不是车主 1 是车主
	private String projectNature; 	// 项目性质 营运 非营运

	public void preInsert(String userid){
		if (StringUtils.isBlank(this.id)){
			setId(IdGen.uuid());
		}
		this.isOwner="0";
		this.createUser=userid;
		this.updateUser=userid;
		this.updateDate = new Date();
		this.createDate = this.updateDate;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(String userid){
		this.updateUser=userid;
		this.updateDate = new Date();
	}


	public String getProjectNature() {
		return projectNature;
	}

	public void setProjectNature(String projectNature) {
		this.projectNature = projectNature;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getIsOwner() {
		return isOwner;
	}

	public void setIsOwner(String isOwner) {
		this.isOwner = isOwner;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}



	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl == null ? null : imgUrl.trim();
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	public String getRecognitionCode() {
		return recognitionCode;
	}

	public void setRecognitionCode(String recognitionCode) {
		this.recognitionCode = recognitionCode;
	}
	
	public String getPlateNumber() {
		return plateNumber;
	}

	public void setPlateNumber(String plateNumber) {
		this.plateNumber = plateNumber;
	}
	
	public String getPlateType() {
		return plateType;
	}

	public void setPlateType(String plateType) {
		this.plateType = plateType;
	}
	
	public String getHolder() {
		return holder;
	}

	public void setHolder(String holder) {
		this.holder = holder;
	}
	
	public Date getRegisterDate() {
		return registerDate;
	}
	public String  getStrRegisterDate()
	{
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
		return  formatter.format(registerDate);
	}

	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}
	
	public String getBrandModel() {
		return brandModel;
	}

	public void setBrandModel(String brandModel) {
		this.brandModel = brandModel;
	}
	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getFuelType() {
		return fuelType;
	}

	public void setFuelType(String fuelType) {
		this.fuelType = fuelType;
	}
	
	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	
	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	
}